﻿using LimaLims.Application.Service.Base.Dto;
using LimaLims.Core;
using LimaLims.Core.Enum;
using LimaLims.Core.Util;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;

namespace LimaLims.Application.Service.Equipment.Dto
{

    public class AddEquipmentRepairInput : BaseDto
    {
        /// <summary>
        /// 报修工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 设备仪器ID
        /// </summary>
        public long EquipmentId { get; set; }

        /// <summary>
        /// 故障描述
        /// </summary>
        public string FaultDescription { get; set; }

        /// <summary>
        /// 故障情况拍照
        /// </summary>
        public string FaultImage { get; set; }

        /// <summary>
        /// 故障情况视频
        /// </summary>
        public string FaultVideo { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public DealStatus Status { get; set; }
    }

    public class EditEquipmentRepairInput : AddEquipmentRepairInput
    {

    }

    /// <summary>
    /// 处理
    /// </summary>
    public class HandleEquipmentRepairInput
    {
        /// <summary>
        /// Id主键
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 报修工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 设备仪器ID
        /// </summary>
        public long EquipmentId { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        public DealOpinon? DealOpinon { get; set; }

        /// <summary>
        /// 审核情况说明
        /// </summary>
        public string DealDescription { get; set; }

        /// <summary>
        /// 是否修复
        /// </summary>
        public bool? IsRepaired { get; set; }

        /// <summary>
        /// 验收情况说明
        /// </summary>
        public string AcceptDescription { get; set; }

        /// <summary>
        /// 验收完成拍照
        /// </summary>
        public string AcceptImage { get; set; }

        /// <summary>
        /// 仪器状态
        /// </summary>
        public EquipmentStatus EquipmentStatus { get; set; }
    }

    public class EquipmentRepairDetail
    {
        /// <summary>
        /// Id主键
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 报修工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 仪器ID
        /// </summary>
        public long EquipmentId { get; set; }

        /// <summary>
        /// 仪器信息
        /// </summary>
        public EquipmentInfoOutput EquipmentInfoOutput { get; set; }

        /// <summary>
        /// 故障描述
        /// </summary>
        public string FaultDescription { get; set; }

        /// <summary>
        /// 故障情况拍照
        /// </summary>
        public string FaultImage { get; set; }

        /// <summary>
        /// 故障情况视频
        /// </summary>
        public string FaultVideo { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 创建者名称
        /// </summary>
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        public DealOpinon? DealOpinon { get; set; }

        /// <summary>
        /// 审核意见文本
        /// </summary>
        public string DealOpinonText => DealOpinon.HasValue ? DealOpinon.GetDescription() : "";

        /// <summary>
        /// 审核说明
        /// </summary>
        public string DealDescription { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string DealUser { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? DealTime { get; set; }

        /// <summary>
        /// 是否修复
        /// </summary>
        public bool? IsRepaired { get; set; }

        /// <summary>
        /// 验收情况说明
        /// </summary>
        public string AcceptDescription { get; set; }

        /// <summary>
        /// 验收完成拍照
        /// </summary>
        public string AcceptImage { get; set; }

        /// <summary>
        /// 验收人
        /// </summary>
        public string AcceptUser { get; set; }

        /// <summary>
        /// 验收时间
        /// </summary>
        public DateTime? AcceptTime { get; set; }

        /// <summary>
        /// 工单状态
        /// </summary>
        public DealStatus Status { get; set; }

        /// <summary>
        /// 工单状态文本
        /// </summary>
        public string StatusText => Status.GetDescription();

        /// <summary>
        /// 打印单据URL
        /// </summary>
        public string ReportUrl { get; set; }
    }

    public class EquipmentRepairOutput
    {
        /// <summary>
        /// Id主键
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 报修工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 仪器编号
        /// </summary>
        public string EquipmentCode { get; set; }

        /// <summary>
        /// 仪器名称
        /// </summary>
        public string EquipmentName { get; set; }

        /// <summary>
        /// 仪器ID
        /// </summary>
        public long EquipmentId { get; set; }

        /// <summary>
        /// 故障描述
        /// </summary>
        public string FaultDescription { get; set; }

        /// <summary>
        /// 故障拍照
        /// </summary>
        public string FaultImage { get; set; }

        /// <summary>
        /// 故障视频
        /// </summary>
        public string FaultVideo { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 创建者名称
        /// </summary>
        public string CreatedUserName { get; set; }

        /// <summary>
        /// 审核意见
        /// </summary>
        public DealOpinon? DealOpinon { get; set; }

        /// <summary>
        /// 审核意见文本
        /// </summary>
        public string DealOpinonText => DealOpinon.HasValue ? DealOpinon.GetDescription() : "";

        /// <summary>
        /// 审核说明
        /// </summary>
        public string DealDescription { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string DealUser { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? DealTime { get; set; }

        /// <summary>
        /// 是否修复
        /// </summary>
        public bool? IsRepaired { get; set; }

        /// <summary>
        /// 验收情况说明
        /// </summary>
        public string AcceptDescription { get; set; }

        /// <summary>
        /// 验收完成拍照
        /// </summary>
        public string AcceptImage { get; set; }

        /// <summary>
        /// 验收人
        /// </summary>
        public string AcceptUser { get; set; }

        /// <summary>
        /// 验收时间
        /// </summary>
        public DateTime? AcceptTime { get; set; }

        /// <summary>
        /// 仪器状态
        /// </summary>
        public EquipmentStatus EquipmentStatus { get; set; }

        /// <summary>
        /// 仪器状态
        /// </summary>
        public string EquipmentStatusText => EquipmentStatus.GetDescription();

        /// <summary>
        /// 工单状态
        /// </summary>
        public DealStatus Status { get; set; }

        /// <summary>
        /// 工单状态文本
        /// </summary>
        public string StatusText => Status.GetDescription();

        /// <summary>
        /// 打印单据
        /// </summary>
        public string ReportUrl { get; set; }
    }

    /// <summary>
    /// 设备报修分页
    /// </summary>
    public class EquipmentRepairPageInput : PageInputBase
    {
        /// <summary>
        /// 设备Id
        /// </summary>
        public long? EquipmentId { get; set; }

        /// <summary>
        /// 报修工单编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 报修人员Id
        /// </summary>
        public long? CreatedUserId { get; set; }

        /// <summary>
        /// 报修时间开始
        /// </summary>
        public DateTime? CreatedTimeStart { get; set; }

        /// <summary>
        /// 报修时间结束
        /// </summary>
        public DateTime? CreatedTimeEnd { get; set; }

        /// <summary>
        /// 工单状态
        /// </summary>
        public DealStatus? Status { get; set; }

    }
}
